﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Innova.Microfinanzas.BusinessEntities;

namespace MyCommerce.Business.GeneralParameters
{
    public class CountryManager
    {
        private MyCommerceEntities vContext;

        public CountryManager()
        {
            if (vContext == null)
            {
                vContext = new MyCommerceEntities();
                vContext.ContextOptions.LazyLoadingEnabled = false;
            }
        }

        public CountryManager(bool lazyLoad)
        {
            if (vContext == null)
            {
                vContext = new MyCommerceEntities();
                vContext.ContextOptions.LazyLoadingEnabled = lazyLoad;
            }
        }

        public List<Country> GetListCountries()
        {
            List<Country> colCountries = new List<Country>();
            var classifierResult = from clt in vContext.Country
                                   select clt;

            if (classifierResult != null)
            {
                colCountries = new List<Country>(classifierResult.AsEnumerable<Country>());
            }

            return colCountries;
        }

    }
}
